#include<stdio.h>
#include<string.h>
#include<assert.h>
#include"dominion.h"
#include"dominion_helpers.h"
#include"rngs.h"
#include<math.h>

int main()
{
	int card = village, start = 5, rep = 0, handPos, bonus;
	struct gameState state;

	state.numPlayers = 2;
	state.deckCount[0] = start;
	state.deckCount[1] = start;
	state.handCount[0] = start;
	state.handCount[1] = start;
	state.discardCount[0] = 0;
	state.discardCount[1] = 0;

	for(int i = 0; i < start;i++)
	{
		state.hand[0][i] = village;
		state.hand[1][i] = village;
	}

	for(int i = 0;i < start;i++)
	{
		state.deck[0][i] = gold;
		state.deck[1][i] = gold;
	}
	
	for(int player = 0;player < 3;player++)
	{
		printf("player: %d\n", player);
		for(state.numActions = 0;state.numActions <= 20;state.numActions++)
		{
			printf("%d\n", state.hand[player][rep]);
			state.phase = 0;
			int actions = state.numActions;
			//handPos = floor(random() * (state.handCount[player] - rep));
			handPos = rep;
			printf("phase: %d : actions: %d : card: %d\n", state.phase, state.numActions, handCard(handPos, &state));
			printf("%d\n", playCard(handPos, 0, 0, 0, &state));
			//cardEffect(village, 0, 0, 0, &state, handPos, bonus);
			zzzvilliagecardplay(player, 0, state);
			//printf("%d : %d : %d\n", state.numActions, actions, actions + 1);
			assert(state.deckCount[player] == start);
			if(actions == 0)
				assert(state.numActions == actions);
			else
				assert(state.numActions == (actions + 1));
			rep++;
		}
	
		rep = 1;
	}
}
